{% extends "learning/base.html" %}

{% block title %}提交作业 · 高中数学助手{% endblock %}

{% block content %}
<section class="card" style="max-width:720px;margin:2rem auto;padding:2.5rem;display:grid;gap:1.2rem;">
    <h2 style="margin:0;">提交作业：{{ assignment.title }}</h2>
    {% if assignment.due_date %}
        <p style="margin:0;color:var(--text-secondary);">截止日期：{{ assignment.due_date|date:"Y-m-d" }}</p>
    {% endif %}
    <p style="margin:0;color:var(--text-secondary);white-space:pre-wrap;">{{ assignment.description }}</p>
    <form method="post" style="display:grid;gap:0.8rem;">
        {% csrf_token %}
        {% for field in form %}
            <label for="{{ field.id_for_label }}">{{ field.label }}</label>
            {{ field }}
            {% for error in field.errors %}
                <small style="color:var(--danger);">{{ error }}</small>
            {% endfor %}
        {% endfor %}
        <div style="display:flex;gap:0.8rem;">
            <button class="button" type="submit">提交作业</button>
            <a class="button secondary" href="{% url 'accounts:profile' %}">返回个人中心</a>
        </div>
    </form>
    {% if submission %}
        <small style="color:var(--text-secondary);">最近提交时间：{{ submission.updated_at|date:"Y-m-d H:i" }}</small>
    {% endif %}
</section>
{% endblock %}
